/** @method useOperatorData
 *  @description 获取操作符的数据
 *  @return Array
 */

import { useEffect, useState } from 'react';
import services from '../services/api';

export default function useOperatorData() {
  const [operator, setOperator] = useState([]);

  useEffect(() => {
    getOperator();
  }, []);

  // 获取操作符
  function getOperator() {
    services.policy.operator().then((res) => {
      if (res.code === '0') {
        setOperator(res.data);
      }
    });
  }

  return operator;
}
